<template>
  <div>
    <h1 ref="title">{{ message }}</h1>
    <school-com ref="school" />
    <button ref="btn" @click="showDOM">点击按钮输出DOM元素</button>
  </div>
</template>

<script>
import School from "./components/School.vue";
export default {
  name: "APP",
  components: {
    "school-com": School,
  },
  data() {
    return {
      message: "欢迎学习Vue",
    };
  },
  methods: {
    showDOM() {
      console.log("获取当前组件实例vc:", this);
      console.log("获取 h1 标签元素:", this.$refs.title);
      console.log("获取School组件实例vc:", this.$refs.school);
    },
  },
};
</script>

<style></style>
